<!DOCTYPE html>
<html lang="en-US">
<title>Media Controls: picture-in-picture button accessibility tests</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../media-controls.js"></script>
<video controls></video>
<script>
async_test(t => {
  if (!document.pictureInPictureEnabled)
    t.done();

  var video = document.querySelector('video');
  video.src = '../content/test.ogv';

  video.oncanplaythrough = t.step_func_done(_ => {
    var pip_button = pictureInPictureButton(video);

    assert_equals(pip_button.getAttribute('aria-label'),
                  'enter picture-in-picture');
     video.requestPictureInPicture().then(t.step_func_done(() => {
       assert_equals(pip_button.getAttribute('aria-label'),
                  'exit picture-in-picture');
    }));
  });
});
</script>
</html>
